Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR] Adding drag n drop and index-based reordering #345

Merged
merged 101 commits into from
Sep 7, 2023
Merged

Conversation

LuchoTurtle
Copy link
Member

@LuchoTurtle LuchoTurtle commented Mar 31, 2023

closes #145

This PR is not-completed. It was a quick attempt to get drag-n-drop working on the mvp by following the work done by @SimonLab and implementing a simple way of sorting the items through an index field within the schema.
Every time an item is dropped to a new index, the indexes of the other items would be updated accordingly.
This is done by updating the index of the items before the item with the new index, as well as the ones after the new index.

This is done by using update_all.

Additionally, this PR tries to implement the changes that @SimonLab made in https://github.com/dwyl/learn-alpine.js/blob/main/drag-and-drop.md (through dwyl/learn-alpine.js#5) but I can't seem to get it to work properly (show the yellow highlight change as I drag an item through the list).

Since the focus is on https://github.com/dwyl/app, it makes sense to tackle #145 there instead of the MVP.

I'm pushing this PR because it might have relevant code to tackle this issue later when we'll eventually implement this strategy on the API, which the Flutter app will connect to.

@LuchoTurtle LuchoTurtle added enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! in-progress An issue or pull request that is being worked on by the assigned person labels Mar 31, 2023
@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #345 (6362525) into main (699e6cc) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #345   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        22    +2     
  Lines          524       599   +75     
=========================================
+ Hits           524       599   +75     
Files Changed Coverage Δ
lib/app_web/controllers/auth_controller.ex 100.00% <ø> (ø)
lib/app/cid.ex 100.00% <100.00%> (ø)
lib/app/item.ex 100.00% <100.00%> (ø)
lib/app/list.ex 100.00% <100.00%> (ø)
lib/app_web/controllers/init_controller.ex 100.00% <100.00%> (ø)
lib/app_web/live/app_live.ex 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@LuchoTurtle
Copy link
Member Author

This should be reviewable.

@LuchoTurtle LuchoTurtle marked this pull request as ready for review April 4, 2023 12:21
@LuchoTurtle LuchoTurtle added awaiting-review An issue or pull request that needs to be reviewed and removed in-progress An issue or pull request that is being worked on by the assigned person labels Apr 4, 2023
@nelsonic nelsonic added in-review Issue or pull request that is currently being reviewed by the assigned person and removed awaiting-review An issue or pull request that needs to be reviewed labels Apr 9, 2023
@nelsonic
Copy link
Member

nelsonic commented Apr 9, 2023

reading through the PR now and noticed that the stats section of the README.md is blank:
https://github.com/dwyl/mvp/blob/drag-drop_fix%23145/BUILDIT.md#14-adding-a-dashboard-to-track-metrics
image

🤷‍♂️

@LuchoTurtle
Copy link
Member Author

LuchoTurtle commented Apr 9, 2023

Probably there was a commit that erased the work I had done because I definitely wrote those sections.
You can see those in https://github.com/dwyl/mvp/blob/faba54760ab0435653434aec7c9f801096fbbd8b/BUILDIT.md, for example.

I'll open a separate issue (#348) and I'll dig through the history for the most updated version and restore that section in a different PR.

@panoramix360
Copy link
Collaborator

If you need any QA testing, just let me know!

@nelsonic
Copy link
Member

nelsonic commented Sep 4, 2023

I'm going to remove the list_items schema and code from this PR ref: #413
Then will do the final tasks and this should be QA-able.

@nelsonic nelsonic mentioned this pull request Sep 5, 2023
4 tasks
@nelsonic
Copy link
Member

nelsonic commented Sep 7, 2023

@nelsonic nelsonic added the merge-conflicts The branch or pull request has merge conflicts with the target branch (e.g. master) label Sep 7, 2023
@nelsonic
Copy link
Member

nelsonic commented Sep 7, 2023

Going to resolve these merge-conflicts quick:
image

@nelsonic
Copy link
Member

nelsonic commented Sep 7, 2023

GitHub with all it's AI superpowers still hasn't figured out how to auto-resolve merge conflicts and is reporting them incorrectly:

image

@nelsonic nelsonic added awaiting-review An issue or pull request that needs to be reviewed and removed merge-conflicts The branch or pull request has merge conflicts with the target branch (e.g. master) in-progress An issue or pull request that is being worked on by the assigned person labels Sep 7, 2023
@nelsonic
Copy link
Member

nelsonic commented Sep 7, 2023

I'm not "happy" with the code. There are quite a few inconsistencies in event and variable names. 😕
Specifically the use of both camel case "dragoverItem" and snake case "move_items" and in the app.js file there are even hyphen even names: "remove-highlight" ... I've opened an issue to tidy this code: #416

But since we've waited way too long for the reordering feature I'm not going to do tidy up now. ⏳
Please feel free to pick this up. 🙏

Copy link
Member

@nelsonic nelsonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature is working. ✅
The migrations are non-destructive and can be rolled-back if needed. 🎢
Let's get @iteles to QA it in prod! 👩‍💻
Ship. :shipit:

@nelsonic nelsonic merged commit b8aee0e into main Sep 7, 2023
3 checks passed
@nelsonic nelsonic deleted the drag-drop_fix#145 branch September 7, 2023 10:39
@nelsonic
Copy link
Member

nelsonic commented Sep 8, 2023

Obvs there was an issue: #417
I'm looking at it now.
But clearly nobody else is using the MVP as their "daily driver" Todo List (yet) as nobody has "complained" about it.

@LuchoTurtle
Copy link
Member Author

I actually noticed the issue yesterday but didn't raise any issue because, as you've stated, you had created it already over at #417, so I figured there was no point in duplicating 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review An issue or pull request that needs to be reviewed enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! priority-1 Highest priority issue. This is costing us money every minute that passes. T1d Time Estimate 1 Day
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

Reordering items
3 participants